package com.example.jetour_line.map.plugin;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.PluginRegistry;

public class MyViewFlutterPlugin {
    private static String NATIVE_VIEW_TYPE_ID = "aha_map_view";

    //旧方法
    public static void registerWith(PluginRegistry registry) {
        final String key = MyViewFlutterPlugin.class.getCanonicalName();
        if (registry.hasPlugin(key)) {
            return;
        }
        PluginRegistry.Registrar registrar = registry.registrarFor(key);
        registrar.platformViewRegistry().registerViewFactory(NATIVE_VIEW_TYPE_ID, new MyViewFactory(registrar.messenger()));
    }

    //新方法
    public static void registerWith(FlutterEngine flutterEngine) {
        flutterEngine.getPlatformViewsController().getRegistry().registerViewFactory(NATIVE_VIEW_TYPE_ID, new MyViewFactory(flutterEngine.getDartExecutor().getBinaryMessenger()));
    }
}

